<?php

App::uses('AppRule', 'Lib');

class ExcludeHolidays extends AppRule {

    public function apply(Leave $leave) {
        $ret  = true;
    	$data = $leave->data['Leave'];
		
		$start = $data['start'];
		$end   = $data['end'];
		
        if ($leave->runsDuringHoliday($start, $end)) {
            $ret = false;
            $this->setError('Leave mustn\'t be during holidays.');
        }
        
        return $ret;
    }

}

?>